package P104;

/**
 * @Author DJ同学
 * @Date 2021/2/11 12:15
 * @Version 1.0
 * @Name 二叉树的深度
 * @Problem https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/
 */
public class Solution {
    public int maxDepth(TreeNode root) {
        if(root==null) return 0;
        int left = root.left==null?0:maxDepth(root.left);
        int right = root.right==null?0:maxDepth(root.right);
        return Math.max(left,right)+1;
    }

}
